package com.mao.config;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author Kechelle
 * @Date 2020/9/7 14:07
 * @Version 1.0
 */
//解决同源策略导致的跨域问题
public class MyConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")       //允许的路径
                .allowedOrigins("*")           //源路径
                .allowedMethods("*")           //方法
                .allowCredentials(true);       //是否发送cookie
    }
}
